using UnityEngine;
using System.Collections;

public class showscore : MonoBehaviour {
	
	public float sco=0.5f;
	public int addscore=10;
	
	void Start () {
	
	}
	void Update () {
		if(sco>0f)
			sco-=Time.deltaTime;
		else if(addscore>0)
		{
			game.score+=addscore;
			addscore=0;
			Destroy(gameObject);
		}
	}
	void OnGUI()
	{
		if(sco>0f)
		{
			Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
			GUI.Label(new Rect(pos.x,Screen.height-pos.y+(sco-0.5f)*100,60,30),""+addscore);
		}
	}
}
